<extend name="Base:common" />
<block name="static">
<link rel="stylesheet" href="__CSS__/goodsdetails.css" />
<link rel="stylesheet" href="__CSS__/pslocation.css" />
<link rel="stylesheet" href="__CSS__/magnifier.css" />
<script src="__PUBLIC__/js/jquery.min.js"></script>
<script src="__PUBLIC__/plugins/layer/layer.min.js"></script>
    <script>
    	//倒计时
		function GetRTime(){
			var EndTime= new Date("{$goodsDetails['auctionTime']}");
			var NowTime = new Date();
			if((EndTime.getTime() - NowTime.getTime())>0){
				var t =EndTime.getTime() - NowTime.getTime();
			}else{
				var t =NowTime.getTime() - EndTime.getTime();
			}

			var d=0;
			var h=0;
			var m=0;
			var s=0;
			if(t>=0){
				d=Math.floor(t/1000/60/60/24);
				h=Math.floor(t/1000/60/60%24);
				m=Math.floor(t/1000/60%60);
				s=Math.floor(t/1000%60);
			}
			document.getElementById("t_d").innerHTML = d;
			document.getElementById("t_h").innerHTML = h;
			document.getElementById("t_m").innerHTML = m;
			document.getElementById("t_s").innerHTML = s;
			}
        //更新参与叫价
        function refreshPrice(){
            var goodsId=$('#goodsId').val();
            var auctionAddPrice=$('#auctionAddPrice').val();
            $.post("{:U('Home/Auction/getNowData')}",{goodsId:goodsId},function(data){
                console.log(data);
                var price=(parseFloat(data.joinMaxPrice)+parseFloat(auctionAddPrice));
                if($('#joinPrice').val()<price){
                    $('#joinPrice').val(price);

                    $('#joinMaxPrice').text(data.joinMaxPrice);
                    $('#joinHotNum').text(data.joinHotNum);
                    $('#auctionLike').text(data.auctionLike);
                    $('#auctionBowse').text(data.auctionBowse);
                    $('#joinHotNum').text(data.joinHotNum);
                    $.each((data.auctionRecord),function(i,v){
                       var $str="<dd id='dd"+(i+1)+"'>"+v['userName']+"在的"+v['actCreateTime']+"时，出价"+v['joinPrice']+"</dd>";
                       $('#dd'+(i+1)).replaceWith($str);
                    });

                }

            });
        }
        setInterval(refreshPrice,5000);
        setInterval(GetRTime,0);
        function joinAuction(){
            var param={};
            param.joinPrice=$('#joinPrice').val();
            param.shopId=$('#shopId').val();
            param.goodsId=$('#goodsId').val();
            layer.confirm('您确定要支付保证金并参加拍卖吗？',{icon: 3, title:'参加提示'}, function(){
                var ll = layer.load('参加中，请稍候...');
                $.post("{:U('Home/Auction/joinAuction')}",param,function(data){
                    layer.close(ll);
                    var json = WST.toJson(data);
                    if(json==1){
                        WST.msg('参加成功!', {icon: 1});
                        window.location.reload();
                    }else if(json==2){
                        console.log(json);
                        WST.msg('请登录再操作!', {icon: 5});
                    }else if(json==3){
                        console.log(json);
                        WST.msg('价格低于参与叫价，无法参加拍卖!', {icon: 5});
                    }else{
                        console.log(json);
                        WST.msg('参加失败!', {icon: 5});
                    }
                });
            });
        }
        function againJoinAuction(){
            var param={};
            param.joinPrice=$('#joinPrice').val();
            param.shopId=$('#shopId').val();
            param.goodsId=$('#goodsId').val();
            layer.confirm('您确定要再次叫价吗？',{icon: 3, title:'叫价提示'}, function(){
                var ll = layer.load('叫价中，请稍候...');
                $.post("{:U('Home/Auction/againJoinAuction')}",param,function(data){
                    layer.close(ll);
                    var json = WST.toJson(data);
                    if(json==1){
                        WST.msg('再次叫价成功!', {icon: 1});
                        window.location.reload();
                    }else if(json==2){
                        console.log(json);
                        WST.msg('请登录再操作!', {icon: 5});
                    }else if(json==3){
                        console.log(json);
                        WST.msg('价格低于参与叫价，无法参加拍卖!', {icon: 5});
                    }else{
                        console.log(json);
                        WST.msg('再次叫价失败!', {icon: 5});
                    }
                });
            });
        }
        function  waitStart(){
            WST.msg('拍卖还未开始，请耐心等待!', {icon: 6});
        }
        function addLikeNum(){
            var goodsId=$('#goodsId').val();
            var ll = layer.load('点赞中，请稍候...');
            $.post("{:U('Home/Auction/addLikeNum')}",{goodsId:goodsId},function(data){
                layer.close(ll);
                if(data==1){
                    WST.msg('点赞成功!', {icon: 1});
                    $('#auctionLike').text(parseInt($('#auctionLike').text())+1);
                }else{
                    console.log(json);
                    WST.msg('点赞失败!', {icon: 5});
                }
            });
        }
        function add(){
            var joinPrice=$('#joinPrice').val();
            var auctionAddPrice=$('#auctionAddPrice').val();
            $('#joinPrice').val((parseInt(joinPrice)+parseInt(auctionAddPrice)));
        }
        var d=1;
        function getDetailsRecord(){
            $('#detailsRecord').show();
            $('#details').text('【查看更多】');
        }


//        $(function(){
//            $('#nowJoinPrice').bind({
//                mouseenter:function(){
//                    var Str='';
//                    var joinPrice=$('#joinPrice').val();
//                    Str="<input type='text' style='height:50px;width:50px;' value='"+joinPrice+"'></input>";
//                    $(this).html(Str);
//                },
//                mouseleave:function(){
//                    var Str='';
//                    var joinPrice=$('#joinPrice').val();
//                    Str="<span  style='height:50px;width:50px;'>"+joinPrice+"</span>";
//                    $(this).html(Str);
//                }
//            })
//        })


		</script> 
</block>
<block name="body">
		<input id="shopId" type="hidden" value="{$goodsDetails['shopId']}"/>
		<input id="goodsId" type="hidden" value="{$goodsDetails['goodsId']}"/>
        <input id="auctionAddPrice" type="hidden" value="{$goodsDetails['auctionAddPrice']}"/>
		<!--加载商品楼层start-->
		<div class="wst-container">
			<div class="wst-nvg-title">
				<a href="{:U('Home/index/index/')}">首页</a>&nbsp;>&nbsp;
				<a href="{:U('Home/Seckill/index/')}">拍卖商品</a>&nbsp;>&nbsp;
				{$goodsDetails["goodsName"]}
			</div>
			<div class="wst-goods-details">
				<div class="details-left">
					<div class="goods-img-box">
						 <!--产品参数开始-->
						  <div>
						    <div id="preview" class="spec-preview"> 
							    <span class="jqzoom">
							    	<img jqimg="__ROOT__/{$goodsDetails['goodsImg']}" src="__ROOT__/{$goodsDetails['goodsImg']}" height="350" width="350"/>
							    </span> 
						    </div>
						    <!--缩图开始-->
						    <div class="spec-scroll"> <a class="prev">&lt;</a> <a class="next">&gt;</a>
						      <div class="items">
						        <ul>
						        	<li><img alt="" bimg="__ROOT__/{$goodsDetails['goodsImg']}" src="__ROOT__/{$goodsDetails['goodsImg']}" onmousemove="preview(this);"></li>
						        	<volist name="goodsImgs" key="k" id="vo">
						          		<li><img alt="" bimg="__ROOT__/{$vo['goodsImg']}" src="__ROOT__/{$vo['goodsImg']}" onmousemove="preview(this);"></li>
						          	</volist>
						        </ul>
						      </div>
						    </div>
						    <!--缩图结束-->
						  </div>
						  <!--产品参数结束-->
						  <div class='wst-short-tool'>
						       <div style='float:left;'>商品编号：{$goodsDetails["goodsSn"]}</div>
						       <div style='float:right;'>
						         <a href='javascript:favoriteGoods({$goodsDetails['goodsId']})'>
						         <b></b>
						         <span id='f0_txt' f='{$favoriteGoodsId}'>
						         <if condition="$favoriteGoodsId gt 0">已关注<else/>关注商品</if>
						         </span>
						         </a>
						       </div>
						  </div>
					</div>
					<div class="goods-des-box">
						<table class="goods-des-tab">
                            <if condition="$goodsDetails['isDeal'] eq true">
                                <tbody>
                                    <tr>
                                        <td colspan="2">
                                            <div class="des-title" style="word-break:break-all;">
                                                {$goodsDetails["goodsName"]}
                                            </div>
                                            <div class='wst-goods-spec'>{$goodsDetails["auctionSecondTitle"]|htmlspecialchars_decode}</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <div>
                                                店铺价：<span style="text-decoration:line-through;margin:0 20px 0 0;">￥{$goodsDetails["shopPrice"]}</span>
                                                起拍价：<font color="red" style="margin:0 20px 0 0;">￥{$goodsDetails["auctionLowPrice"]}</font>
                                                递增价：<font color="red" style="margin:0 20px 0 0;">￥{$goodsDetails["auctionAddPrice"]}</font>
                                                中标数：<font color="red">{$goodsDetails["auctionWinNum"]}人</font>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td width="60">拍卖状态：</td>
                                        <td><eq name="goodsDetails['isDeal']" value="1">成功结束<else/>流拍</eq></td>
                                    </tr>
                                    <tr>
                                        <td>成交记录：</td>
                                        <td>
                                            <volist name="goodsDetails['recordData']" id="v">
                                                {$i}.{$v['userName']}-￥{$v['joinPrice']}
                                            </volist>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>叫价记录：</td>
                                        <td>
                                            <div style="height:140px;overflow :auto;border:1px solid #aaa">
                                            <volist name="goodsDetails['auctionRecord']" id="vvo">
                                                <dd>{$vvo['userName']} 在 {$vvo['actCreateTime']} 时，叫价{$vvo['joinPrice']}</dd>
                                            </volist>
                                            </div>
    
                                        </td>
                                    </tr>
                                </tbody>
                            <else/>
                                <tbody>
                                <tr>
                                    <td colspan="2">
                                        <div class="des-title" style="word-break:break-all;">
                                            {$goodsDetails["goodsName"]}
                                        </div>
                                        <div class='wst-goods-spec'>{$goodsDetails["auctionSecondTitle"]|htmlspecialchars_decode}</div>
                                    </td>
                                </tr>
                                <tr style="height:10px;line-height:10px;">
                                    <td colspan="2">
                                        <div >
                                            店铺价：<span style="text-decoration:line-through;margin:0 20px 0 0;">￥{$goodsDetails["shopPrice"]}</span>
                                            起拍价：<font color="red" style="margin:0 20px 0 0;">￥{$goodsDetails["auctionLowPrice"]}</font>
                                            递增价：<font color="red" style="margin:0 20px 0 0;">￥{$goodsDetails["auctionAddPrice"]}</font>
                                            中标数：<font color="red">{$goodsDetails["auctionWinNum"]}人</font>
                                        </div>
                                    </td>
                                </tr>
                                <tr style="height:20px;line-height:20px;font-size:15px;">
                                    <td colspan="2" style="height:20px;line-height:20px;font-size:15px;">

                                        参与叫价：<a href="javascript:add();"><span id="add">【+】</span></a><span style="color:red;font-size:25px;">￥</span><input value="{$goodsDetails['nowJoinPrice']}" style="color:red;font-size:25px;padding:0px;margin:0px;border:none" type="text" id="joinPrice"/>

                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                            <span style="margin:0 20px 0 0;font-size:16px;">
                                                <img src="__IMG__/count_down.jpg" width="20" height="20" style="margin-top:-2px;">距离拍卖{$goodsDetails["state"]}还有：<span id="t_d" style="font-size:24px;color: red">00</span>天<span id="t_h" style="font-size:24px;color: red">00</span>时<span id="t_m" style="font-size:24px;color: red">00</span>分<span id="t_s" style="font-size:24px;color: red">00</span>秒
                                            </span>

                                    </td>
                                </tr>
                                <tr>
                                    <td width="70"><span class="des-title-span">配送至：</span></td>
                                    <td>
                                        <li id="summary-stock">
                                            <div class="dd">
                                                <div id="store-selector">
                                                    <div class="text">
                                                        <div></div>
                                                        <b></b>
                                                    </div>
                                                </div><!--store-selector end-->
                                                <div id="store-prompt">
                                                    <strong></strong>
                                                </div>
                                            </div>
                                        </li>
                                        <div class="wst-clear"></div>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="70"><span class="des-title-span">运费：</span></td>
                                    <td>{$goodsDetails["auctionLabel"]}</td>
                                </tr>
                                <tr>
                                    <td width="70"><span class="des-title-span">服务：</span></td>
                                    <td>由
                                        <if condition="$goodsDetails['deliveryType'] eq 1">
                                            {$CONF['mallName']}
                                            <else/>
                                            <a href="{:U('Home/Shops/toShopHome/',array('shopId'=>$goodsDetails['shopId']))}">{$goodsDetails['shopName']}</a>
                                        </if>
                                        配送，并提供售后服务</td>
                                </tr>
                                <tr>
                                    <td width="70"><span class="des-title-span">拍卖详情：</span></td>
                                    <td>
                                        目前最高叫价为<span id="joinMaxPrice">{$goodsDetails['joinMaxPrice']}</span>元<a href="javascript:getDetailsRecord();"><span id="details">【查看详情】</span></a>
                                        <dl id="detailsRecord" style='display:none;'>
                                            <volist name="goodsDetails['auctionRecord']" id="vvo" >
                                                <dd id="dd{$i}">{$vvo['userName']} 在 {$vvo['actCreateTime']} 时，叫价{$vvo['joinPrice']}</dd>
                                            </volist>
                                        </dl>
                                    </td>
                                </tr>

                                <tr>
                                    <td style="position: relative;">
                                        <div id='qrBox' style='position:absolute ;top:-50px;left:450px;padding:2px;'>
                                            <div id='qrcode' style='width:132px;height:132px;border:1px solid #ddd;margin-bottom:2px;'></div>
                                            <div>下载移动客户端扫一扫</div>
                                        </div>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td width="70"></td>
                                    <td>
                                        <a <eq name="goodsDetails['state']" value="开始">href='javascript:waitStart();'<else/><if condition="$goodsDetails['userJoinStatus'] eq true">href="javascript:againJoinAuction();"<else/>href="javascript:joinAuction();"</if> </eq>><span style="width:60px;height:40px;line-height:40px;text-align:center;border:1px solid green;display:block;float:left;">参与</span></a>




                                        <a href="javascript:addLikeNum();"><span style="width:30px;height:40px;display:block;float:left;"></span>  <span style="width:auto;height:40px;line-height:40px;text-align:center;border:1px solid blue;display:block;float:left;">点赞（<span id="auctionLike">{$goodsDetails['auctionLike']}</span>）</span></a>
                                        <span style="width:30px;height:40px;display:block;float:left;"></span>  <span style="width:auto;height:40px;line-height:40px;text-align:center;border:1px solid blue;display:block;float:left;">热度（<span id="joinHotNum">{$goodsDetails['joinHotNum']}</span>）</span>
                                        <span style="width:30px;height:40px;display:block;float:left;"></span>  <span style="width:auto;height:40px;line-height:40px;text-align:center;border:1px solid blue;display:block;float:left;">浏览（<span id="auctionBowse">{$goodsDetails['auctionBowse']}</span>）</span>
                                    </td>
                                </tr>
                                </tbody>
                            </if>
						</table>
						
					</div>
				</div>
				<div class="details-right">
					<table class="details-tab">
						<tbody>
							<tr>
								<td class="title">店铺名称：</td>
								<td>{$goodsDetails["shopName"]}</td>
							</tr>
							<tr>
								<td class="title">营业时间：</td>
								<td>{$goodsDetails['serviceStartTime']}-{$goodsDetails['serviceEndTime']}</td>
							</tr>
							<tr>
								<td class="title">配送说明：</td>
								<td>{$goodsDetails["deliveryStartMoney"]}元起，配送费{$goodsDetails["deliveryMoney"]}元<br/>{$goodsDetails["deliveryFreeMoney"]}元起免配送费<br/><br/></td>
							</tr>
							<tr>
								<td class="title">店铺地址：</td>
								<td>{$goodsDetails['shopAddress']}</td>
							</tr>
							<tr>
								<td class="title">店铺电话：</td>
								<td>{$goodsDetails['shopTel']}</td>
							</tr>
							<if condition="$goodsDetails['qqNo'] neq ''">
							<tr>
								<td class="title">&nbsp;QQ咨询：</td>
								<td>
									<a href="tencent://message/?uin={$goodsDetails['qqNo']}&Site=QQ交谈&Menu=yes">
									<img border="0" src="http://wpa.qq.com/pa?p=1:{$goodsDetails['qqNo']}:7" alt="QQ交谈" width="71" height="24" />
									</a><br/>
								</td>
							</tr>
							</if>
							<tr>
								<td ></td>
								<td></td>
							</tr>
							<tr>
								<td colspan="2" class="wst-shop-eval">
									<div class="shop-eval-box" style="width:220px;margin:0 auto;">
										    <li>商品<br/>{$shopScores["goodsScore"]}</li>
											<li class="li-center">时效<br/>{$shopScores["timeScore"]}</li>
											<li>服务<br/>{$shopScores["serviceScore"]}</li>
										<div class="wst-clear"></div>
									</div>
								</td>
							</tr>
							<tr>
								<td ></td>
								<td></td>
							</tr>
							<tr>
								<td colspan="2" class="wst-shop-eval">
									<div class="shop-eval-box" style="width:214px;margin:0 auto;">
										<a class='wst-shop-btn' href="{:U('Home/Shops/toShopHome/',array('shopId'=>$goodsDetails['shopId']))}">
										进入店铺
										</a>
										<a class='wst-shop-btn' href="javascript:favoriteShops({$goodsDetails['shopId']})">
										<span id='f1_txt' f='{$favoriteShopId}'><if condition="$favoriteShopId gt 0">已关注<else/>关注店铺</if></span>
										</a>
									</div>
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="wst-clear"></div>
			</div>
			
			<div class="wst-goods-pdetails">
				<div class="wst-goods-pdetails-left">
					{:W('Goods/getHotGoods',array('shopId'=>$goodsDetails['shopId']))}
					{:W('Goods/getViewGoods')}
				</div>
				<div id="wst-goods-pdetails-right" class="wst-goods-pdetails-right">
					<div class="goods-nvg">
						<ul class="tab">
							<li onclick="tabs('#wst-goods-pdetails-right',0)" class="curr">商品介绍</li>
							<if condition=" count($goodsAttrs['attrs']) gt 0">
							<li onclick="tabs('#wst-goods-pdetails-right',1)">商品属性</li>
							<li onclick="tabs('#wst-goods-pdetails-right',2)">商品评价</li>
							<else/>
							<li onclick="tabs('#wst-goods-pdetails-right',1)">商品评价</li>
							</if>
						</ul>
						<div class="wst-clear"></div>
					</div>
					<div class="tabcon">
						<div id="wst_goods_desc" style="font-weight:bolder;height:auto;line-height:30px;padding-left:8px;">
						{$goodsDetails["goodsDesc"]}
						</div>
					</div>
					<if condition=" count($goodsAttrs['attrs']) gt 0">
					<div class="tabcon" style="display:none;">
						<table class='wst-attrs-list'>
						  <volist name="goodsAttrs['attrs']" id="vo">
						  <if condition="$vo['attrContent'] !='' ">
						  <tr>
						    <th nowrap>{$vo['attrName']}：</th>
						    <td>{$vo['attrContent']}</td>
						  </tr>
						  </if>
						  </volist>
						</table>
					</div>
					</if>
					<div class="tabcon"  style="display:none;">						
						<table id="appraiseTab" width="100%">
							<tr>
								<td>
		                      	 	<div style="margin-top: 10px;" id="allgoodsppraises">
		                           		 请稍等...
		                        	</div>
		                        </td>
		                	</tr>
	                   	</table>  
	                   	<div id="wst-page-items" style="text-align:center;margin-top:5px;"></div>                  
					</div>
					<div class="wst-clear"></div>
				</div>
				<div class="wst-clear"></div>
			</div>
			<div class="wst-clear"></div>
		</div>
</block>
<block name="footer_static">
<script src="__JS__/goods.js"></script>
<script src="__JS__/pslocation.js" type="text/javascript"></script>
<script src="__JS__/jquery.jqzoom.js" type="text/javascript"></script>
<script src="__JS__/magnifier.js" type="text/javascript"></script>
<script src="__PUBLIC__/js/qrcode.js"></script>
<script> 
$("#store-selector").hover(function() {
}, function(){
	$("#store-selector").removeClass("hover");
});


$(function(){
	var qr = qrcode(10, 'M');
	qr.addData("{$qrcode}");
	qr.make();
	$('#qrcode').html(qr.createImgTag());
	getGoodsappraises({$goodsDetails["goodsId"]},0);
	$("#wst_goods_desc img").each(function(){
		if($(this).width()>940){
			$(this).width(940);
		}
	});
});
</script>
</block>


